package com.mask.thread.pk05;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author hx
 * @since 2021/12/2 3:03 下午
 */

public class MyService {
    private Lock lock = new ReentrantLock();

    public void testMethod() {
        lock.lock();

        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName()+" " + i);
        }
        lock.unlock();
    }

}
